<html xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>修改设备信息</title>
    <div th:include="layout/resources :: resources"></div>
</head>
<body>
<div>
    <div class="container-fluid">
        <table id="modelList"></table>
    </div>
</div>
</body>
<script th:inline="javascript">
    $("#modelList").framework().bootstrapTable({
        url: "/robot/model/getListByPage",
        clickToSelect: true,
        columns: [{
            radio: true
        }, {
            field: '',
            title: '序号',
            align: 'center',
            valign: 'middle',
            formatter: function (value, row, index) {
                return index + 1;
            }
        }, {
            field: 'brand',
            title: '品牌',
            align: 'center',
            valign: 'middle'
        }, {
            field: 'model',
            title: '型号',
            align: 'center',
            valign: 'middle'
        }, {
            field: 'resolution',
            title: '分辨率',
            align: 'center',
            valign: 'middle'
        }, {
            field: 'versionAndroid',
            title: '安卓版本',
            align: 'center',
            valign: 'middle'
        }, {
            field: 'osApi',
            title: 'OsApi',
            align: 'center',
            valign: 'middle'
        }, {
            field: 'dpi',
            title: 'Dpi',
            align: 'center',
            valign: 'middle'
        }, {
            field: 'count',
            title: '随机概率',
            align: 'center',
            valign: 'middle'
        }]
    });
    $("#modelList").on('click-row.bs.table', function (row, $element, field) {

        $.ajax({
            method: "post",
            url: createUrl('/robot/update'),
            data: {
                simCode: [[${simCode}]], brand: $element.brand,
                model: $element.model, displayId: $element.displayId,
                versionAndroid: $element.versionAndroid,
                board: $element.board
            },
            success: function (result) {
                if (result.success) {
                    parent.refresh();
                    framework.alert("修改成功");
                    parent.layer.closeAll();
                } else {
                    framework.alert("修改失敗:" + result.error);
                }
                layer.close(index);
            }
        })
    });
</script>
</html>
